package com.baidu;

/**
 * @Author 12629
 * @Description：
 */
public class Student {
    public String name;//实例成员变量
    public int age;

    public static String classRoom = "111";

    static {
        System.out.println("static{}2....");
    }

    static {
        classRoom = "415";
        //this.age = 100;
        System.out.println("static{}1....");
    }

    {
        //可以来初始化 这些非静态数据成员
        this.age = 100;
        //classRoom = "fafa";
        System.out.println("构造代码块");
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("构造方法被调用了....");
    }

    public static void staticFunc() {
        //System.out.println(this.name);
        //show();
        //static int a = 10;
        System.out.println("staticFunc");
    }

    public void show() {
        //staticFunc();
        System.out.println("姓名："+this.name
                +" 年龄："+this.age);
    }
    //动态绑定  下周二上课会讲 alt+insert
    /*public String toString() {
        return "姓名："+this.name
                +" 年龄："+this.age;
    } */

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
